package com.zzyy.study;


/**
 * @auther zzyy
 * @create 2024-03-25 22:54
 */
public class T1
{
    public static void main(String[] args)
    {
        Class<?> clazz = Fish.class;
        //System.out.println(clazz.getName());

        System.out.println();

        Class<?> aClass = null;

        try
        {
            aClass = Class.forName("com.zzyy.study.Fish");
            Fish fish1 = (Fish) aClass.getDeclaredConstructor().newInstance();
            Fish fish2 = (Fish) aClass.newInstance();

            System.out.println(fish1.myRun());
        } catch (Exception e) {
            throw new RuntimeException(e);
        }


    }
}


class Fish
{
    private int id;
    private String fishName;

    public Fish()
    {
        System.out.println("----我是fish构造方法");
    }

    public String myRun()
    {
        return "--鱼在水里游";
    }
}